package com.aabbc.aaaaa.test.schreport;

import com.fecean.aabbc.commons.easy.Easy;

import java.time.LocalDate;

/**
 * SchReportGenerater
 *
 * @author: chenfenghai
 * @version: 1.0
 * @date: 2019-12-27 13:53
 * @blame Team
 */
public class SchReportGenerator {
    static String dateStart = "2019-01-01";
    static String dateEnd = "2019-08-17";
    static String uidCinema = "bf4482a1-4a71-4940-a600-2799b7430531";

    public static void main(String[] args) {
        Easy.Asserter.isDate(dateStart);
        Easy.Asserter.isDate(dateEnd);
        Easy.Asserter.notBlank(uidCinema);

        StringBuilder sb = new StringBuilder();
        sb.append("INSERT INTO SCH_REPORT(UID_CINEMA,REPORT_DATE,UID_TARGET,REPORT_STATUS,APPLY_FLAG,REPORT_TYPE,UID_SYNC) VALUES ");

        LocalDate currentDate = Easy.Date.of(dateStart).toLocalDate();
        LocalDate maxDate = Easy.Date.of(dateEnd).toLocalDate();
        while (!currentDate.isAfter(maxDate)){
            sb.append("\n('");
            sb.append(uidCinema.trim());
            sb.append("','");
            sb.append(Easy.Date.of(currentDate).toDateString());
            sb.append("',UUID(),'3', 0, 1, UUID()),");

            currentDate = currentDate.plusDays(1);
        }
        sb.deleteCharAt(sb.length() - 1).append(";");
        System.out.println(sb.toString());
    }
}
